/**
 * UserServiceImp.java
 *
 *
 * $LastChangedBy: allen $
 * $LastChangedDate: 2007-12-11 14:49:39 +0800 $
 * $Revision: 1437 $
 */
package com.myspace.service.user;

import java.util.List;
import java.util.Map;

import com.myspace.dao.UserDao;
import com.myspace.domain.User;
import com.myspace.common.exception.ErrorPasswordException;
import com.myspace.common.exception.UserNotFoundException;

public class UserServiceImp implements UserService {

	private UserDao dao;

	public User getUser(long userId) {
		return this.dao.findById(userId);
	}

	public User login(User user) throws UserNotFoundException,
			ErrorPasswordException {
		return dao.findByNameAndPassword(user);
	}

	public void update(User user) {
		this.dao.update(user);
	}

	public List<User> getLastUpdated() {
		return this.dao.getLastUpdated();
	}

	public List<User> getHot() {
		return this.dao.getHot();
	}

	public User register(User user) {
		return dao.save(user);
	}

	public UserDao getDao() {
		return dao;
	}

	public void setDao(UserDao dao) {
		this.dao = dao;
	}

	public Map<Long, User> findbyIds(Long[] ids)
	{

		return this.dao.findbyIds(ids);
	}

}
